package com.chance.cc.crawler.prod.command.trigger.domain.news.tianya;

import com.chance.cc.crawler.core.CrawlerJob;
import com.chance.cc.crawler.core.downloader.HttpPage;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;
import com.chance.cc.crawler.prod.command.job.domain.news.tianya.luntan.TianYaAutoAgeCommentCrawlerScheduleJob;
import com.chance.cc.crawler.prod.command.job.domain.news.tianya.tianyakeys.TianYaNewsCrawlerScheduleJob;
import com.chance.cc.crawler.prod.command.trigger.CommonCrawlerSchedulerTrigger;

/**
 * @author bx
 * @date 2020/12/7 0007 11:15
 */
public class TianYaCommonScheduleTrigger extends CommonCrawlerSchedulerTrigger {

    public static void main(String[] args) {//运行工作爬虫
//        publishAutoAgeCommentRealtimeScheduleTriggerInfo(TianYaAutoAgeCommentCrawlerScheduleJob.publishTianYaAutoAgeCommentCrawlerScheduleJobInfo());//汽车时代评论
//        publishAutoAgeArticleRealtimeScheduleTriggerInfo(TianYaAutoAgeArticleCrawlerScheduleJob.publishTianYaAutoAgeArticleCrawlerScheduleJobInfo());//汽车时代文章
        //publishPurchaseCommentRealtimeScheduleTriggerInfo(TianYaPurchaseCommentCrawlerScheduleJob.publishTianYaPurchaseCommentCrawlerScheduleJobInfo());//购车咨询评论
//        publishPurchaseArticleRealtimeScheduleTriggerInfo(TianYaPurchaseArticleCrawlerScheduleJob.publishTianYaPurchaseArticleCrawlerScheduleJobInfo());//购车咨询文章

        publishArticleRealtimeScheduleTriggerInfo();
    }

    //汽车时代评论
    public static void publishAutoAgeCommentRealtimeScheduleTriggerInfo(CrawlerJob crawlerJob){//实时调度触发信息
        HttpPage page = metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(//添加调度爬虫触发
                crawlerJob.generateCrawlerKey(),//生成爬虫key
                crawlerJob.generateCrawlerTriggerKey(),//生成爬虫触发key
                TianYaAutoAgeCommentCrawlerScheduleJob.domain,//工作的域
                CrawlerMetaConstant.ScheduleJobTrigger_Cron, "0 0 1 * * ?", "汽车时代评论每天一1点定时采集");//采集信息
        System.out.println("添加采集调度： "+page.getRawText());//调度文本
    }

    //汽车时代文章
    public static void publishAutoAgeArticleRealtimeScheduleTriggerInfo(CrawlerJob crawlerJob){//实时调度触发信息
        HttpPage page = metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(//添加调度爬虫触发
                crawlerJob.generateCrawlerKey(),//生成爬虫key
                crawlerJob.generateCrawlerTriggerKey(),//生成爬虫触发key
                TianYaAutoAgeCommentCrawlerScheduleJob.domain,//工作的域
                CrawlerMetaConstant.ScheduleJobTrigger_Cron, "0 0 1 * * ?", "汽车时代文章每天1点定时采集");//采集信息-
        System.out.println("添加采集调度： "+page.getRawText());//调度文本
    }

    //购车咨询评论
    public static void publishPurchaseCommentRealtimeScheduleTriggerInfo(CrawlerJob crawlerJob){//实时调度触发信息
        HttpPage page = metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(//添加调度爬虫触发
                crawlerJob.generateCrawlerKey(),//生成爬虫key
                crawlerJob.generateCrawlerTriggerKey(),//生成爬虫触发key
                TianYaAutoAgeCommentCrawlerScheduleJob.domain,//工作的域
                CrawlerMetaConstant.ScheduleJobTrigger_Cron, "0 0 1 * * ?", "购车咨询评论每天1点定时采集");//采集信息-
        System.out.println("添加采集调度： "+page.getRawText());//调度文本
    }
    //购车咨询文章
    public static void publishPurchaseArticleRealtimeScheduleTriggerInfo(CrawlerJob crawlerJob){//实时调度触发信息
        HttpPage page = metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(//添加调度爬虫触发
                crawlerJob.generateCrawlerKey(),//生成爬虫key
                crawlerJob.generateCrawlerTriggerKey(),//生成爬虫触发key
                TianYaAutoAgeCommentCrawlerScheduleJob.domain,//工作的域
                CrawlerMetaConstant.ScheduleJobTrigger_Cron, "0 0 1 * * ?", "购车咨询文章每天1点定时采集");//采集信息-
        System.out.println("添加采集调度： "+page.getRawText());//调度文本
    }
//天涯新闻关键字采集
    public static void publishArticleRealtimeScheduleTriggerInfo(){
        CrawlerJob crawlerJob = TianYaNewsCrawlerScheduleJob.articleSchedule();
        HttpPage httpPage = metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                TianYaNewsCrawlerScheduleJob.DOMAIN,
                //CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                CrawlerMetaConstant.ScheduleJobTrigger_Simple,
                "",
                //"0 0 0 * * ?",
                "每日采集新闻文章回复评论"
        );
        System.out.println("添加采集调度："+httpPage.getRawText());
    }
}
